package org.travel_system.mapper;


import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.travel_system.pojo.User;

@Mapper
public interface UserMapper {
    //添加
    @Insert("insert into tourist(username, password)"+
            "values(#{username},#{password}) ")
    int add(String username, String password);

    //查询
    @Select("select * from tourist where username=#{username}")
    User findByUserName(String username);

    //更新
    @Update("update tourist set phone_number = #{phoneNumber} where tourist_id=#{id}")
    int update(User user);

    //更新密码
    @Update("update tourist set password=#{md5String} where tourist_id=#{id}")
    int updatePwd( String md5String, Integer id);

    //查询id
    @Select("select tourist_id from tourist where username=#{username}")
    Integer findUserId(String username);
}
